package titt.head;

import titt.util.ArrayUtil;

public class HeadFactory {
	
	public static final HTTPHead EMPTY = createHead();
	
	//Bound util
	public static String generateBoundary() {
		String ret = "---------------------------";
		for(int i = 0; i < 29; i++)
			ret += (int)Math.floor(Math.random()*10);
		return ret;
	}

	
	//Non Decorative
	public static HTTPHead createHead(String status, Header... headers) {
		return new Head(status, headers);
	}
	
	public static HTTPHead createHead(Header... headers) {
		return new Head(null, headers);
	}

	//Decorative
	public static HTTPHead createHead(HTTPHead h, Header... headers) {
		return createHead(h.getStatusLine(), ArrayUtil.combine(headers, h.getAllHeaders()));
	}
	
	public static HTTPHead createHead(HTTPHead h, String status, Header... headers) {
		return createHead(status, createHead(h, headers).getAllHeaders());
	}
	
}
